package com.x.chalk.service.impl;

import com.x.chalk.dao.ResumeDao;
import com.x.chalk.entity.Resume;
import com.x.chalk.service.intf.ResumeService;
import com.x.chalk.vo.R;
import org.hibernate.annotations.Source;
import org.springframework.stereotype.Service;

@Service
public class ResumeServiceImpl implements ResumeService {

    @Source
    private ResumeDao dao;
    /**
     * 添加简历
     * @param resume
     * @return
     */
    @Override
    public R save(Resume resume) {
        //入参校验
        if (resume!=null){
            if (dao.insert(resume)>0) {
                return R.ok();
            }
        }
        return R.fail();
    }

    /**
     * 查看简历
     * @param token
     * @return
     */
    @Override
    public R selectOne(String token) {
        int uid = Integer.parseInt(token);
        return R.ok(dao.selectById(uid));
    }
}
